<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('文件新增')"/>
</head>
<body>
<form class="layui-form">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
                 <div class="layui-form-item">
                    <label class="layui-form-label">文件名称</label>
                    <div class="layui-input-block">
                        <div class="layui-upload-drag" id="test10">
                          <i class="layui-icon"></i>
                          <p>点击上传，或将文件拖拽到此处</p>
                          <div class="layui-hide" id="uploadDemoView">
                            <hr>
                            <img src="" alt="上传成功后渲染" style="max-width: 196px">
                          </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
<th:block th:include="include :: footer"/>
<script>
    layui.use(['form', 'jquery','upload'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let MODULE_PATH = rootPath+"/auth/SignApplyController/";
        let upload = layui.upload;
        
         //拖拽上传 文档：https://www.layui.com/doc/modules/upload.html
        upload.render({
            elem: '#test10'
            ,url: MODULE_PATH+"/uploadApplyFile"//改成您自己的上传接口
            ,field: 'txtFile' //设定文件域的字段名
            ,accept: 'file'
            ,size: 5000 //最大允许上传的文件大小
            ,number:1
            ,exts: 'txt' //只允许上传txt文件
            ,done: function(result){
               if (result.successful) {
                    layer.msg('上传成功');
                    setTimeout(function () {
		                parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                    	parent.layui.table.reload("signApply-table");
		            }, 2000);
               } else {
                    layer.msg(result.msg, {icon: 2, time: 1000});
               }
            }
        });

    })
</script>
</body>
</html>